<?php get_header();?>
<section class="index_area">
    <div class="container">
        <div class="row g-3 justify-content-center">
            <div class="col-lg-9">
        		<div class="post_container_title">
		    		<h1><?php the_title(); ?></h1>
		    		<p>
                        <span><i class="bi bi-text-left"></i><?php the_category(', ') ?></span>
		    			<span><i class="bi bi-clock"></i><?php the_time('Y-m-d'); ?></span>
		    			<span><i class="bi bi-eye"></i><?php post_views('',''); ?> 人浏览</span>
		    		</p>
		    	</div>
            	<div class="post_container">
					<?php while( have_posts() ): the_post(); $p_id = get_the_ID(); ?>
					<article class="wznrys">
					<?php the_content(); ?>
					</article>
					<?php endwhile; ?>
				</div>
                <div class="post_author_r">
                    <div class="post_author_tag">
                        <?php the_tags( '<em><i class="bi bi-hash"></i>', '</em><em><i class="bi bi-hash"></i>', '</em>' ); ?>
                    </div>
                </div>
				<div class="post_author row g-3">
					<div class="post_author_l col-12 col-lg-6" style="letter-spacing: 0.05em;">
						<?php echo get_avatar(get_the_author_meta('email'), 80); ?>
						<div style="display: flex; flex-direction: column;">
                            <span style="font-weight: bolder; font-size: 1.125rem; line-height: 2"><?php the_author_meta('nickname'); ?></span>
                            <span style="color: #8c8989"><?php the_author_meta('user_description'); ?></span>
                        </div>
					</div>
					<div class="post_author_r col-12 col-lg-6">
                        <div class="post_related mb-3">
                            <?php
                            global $post;
                            $cats = wp_get_post_categories($post->ID);
                            if ($cats) {
                                $args = array(
                                    'category__in' => array( $cats[0] ),
                                    'post__not_in' => array( $post->ID ),
                                    'showposts' => 3,
                                    'ignore_sticky_posts' => 1
                                );
                                query_posts($args);
                                if (have_posts()) {
                                    while (have_posts()) {
                                        the_post(); update_post_caches($posts); ?>

                                        <div class="post_related_list">
                                            <a class="" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
                                        </div>

                                    <?php } } else { echo ''; } wp_reset_query(); } else { echo ''; } ?>
                        </div>
					</div>
				</div>
				<div class="post_comment" id="post_comment_anchor">
					<?php
					if ( comments_open() || get_comments_number() ) :
					    comments_template();
					endif;
					?>
				</div>
            </div>
        </div>
    </div>
</section>

<?php if (get_theme_mod('ds_highlight')) { ?>
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/assets/highlight/atom-one-light.css">
<script src="<?php bloginfo('template_directory'); ?>/assets/highlight/highlight.min.js"></script>
<script src="<?php bloginfo('template_directory'); ?>/assets/highlight/highlightjs-line-numbers.min.js"></script>
<script>
hljs.initHighlightingOnLoad();
$(document).ready(function() {
    $('.wznrys pre code').each(function(i, block) {
        hljs.lineNumbersBlock(block);
    });
});
</script>
<?php } ?>

<?php get_footer(); ?>